﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data.SqlClient;
using LogisticsAdmin.Model;

namespace LogisticsAdmin.DAL
{
    public class NewsDAL
    {
        public NewsModel NewsInfo(int newsId)
        {


            string sql = @"SELECT [TeamID],[TeamName],[Leader],[Remark],[CheckInTime],[IsDelete],[AlterTime]
  FROM[TruckTeam]  WHERE TeamID = @newsId";
            SqlParameter[] para = {
            new SqlParameter("@newsId",newsId)
            };
            SqlDataReader sdr = SQLHelper.ExecuteReader(sql, para);
            NewsModel newsModel = new NewsModel();
            if (sdr.HasRows)
            {
                while (sdr.Read())
                {
                    newsModel.Remark = sdr["Remark"].ToString();
                    newsModel.TeamID = Convert.ToInt32(newsId);
                    newsModel.TeamName = sdr["TeamName"].ToString();
                }
            }
            return newsModel;
        }
    }
}
